package router

import (
	"0519/api/handler"
	"0519/common/pkg"
	"github.com/gin-gonic/gin"
)

func Router(r *gin.Engine) {

	user := r.Group("/user")
	{
		user.POST("/login", handler.UserLogin)
	}

	administrators := r.Group("/administrators")
	{
		administrators.Use(pkg.JWTAuth("2209A"))
		administrators.POST("/course/add", handler.CourseAdd)
		administrators.GET("/course/list", handler.CourseList)
		administrators.POST("/course/info", handler.CourseInfo)
		administrators.POST("/course/update/state", handler.CourseUpdateState)
		administrators.POST("/course/deleted", handler.CourseDeleted)
		administrators.POST("/discount/course/create", handler.CreateDiscountCourse)
		administrators.POST("/discount/order/list", handler.OrderList)
	}
	customer := r.Group("customer")
	{
		administrators.Use(pkg.JWTAuth("2209A"))
		customer.POST("/create/order", handler.CreateDiscountCourseOrder)
		customer.POST("/order/pay", handler.OrderPay)
	}
}
